package cn.YstHome.dao.impl;

import cn.YstHome.dao.YstHomeDao;
import common.service.MryeDataCenterService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.List;
import java.util.Map;

@Component("ystHomeDao")
public class YstHomeDaoImpl implements YstHomeDao {

    @Autowired
    MryeDataCenterService mryeDataCenterService;

    @Override
    public List<Map<String, Object>> getYstInfoNav(Map<String, Object> params) {

        String sql="SELECT Z_ID AS ZID,F_ID AS FID,NAV_NAME AS DHMC,NAV_URL AS DHURL,NAV_KEYWORD AS DHGJC,NAV_DES AS DHSM,DISPLAY AS XIANSHI " +
                   "FROM YST_INFO_NAV ";
        if(params.containsKey("ZID")){
            sql=sql+" WHERE Z_ID=#{ZID}";
        }
        params.put("sql",sql);
        return mryeDataCenterService.searchSapList(params);
    }

    public Map<String,Object> getYstInfo(Map<String, Object> params){
        String sql="SELECT NAV_NAME AS DHMC, NAV_KEYWORD AS DHGJC, NAV_DES AS DHSM, INFO_LOGO AS SY_LOGO, INFO_COPYRIGHT AS SY_BQ, INFO_RECORD AS SY_BA, INFO_OTHER AS SY_QT FROM YST_INFO LEFT JOIN YST_INFO_NAV ON DISPLAY = 1 AND Z_ID = #{DHID}";
        params.put("sql",sql);
        return mryeDataCenterService.searchSap(params);
    }
}
